package collection;

import annotation.MyInterface;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

public class ListDemo {

    public static void main(String[] args) throws ClassNotFoundException {
        List list = new ArrayList<>();
        List<Object> objects = Arrays.asList();//可以把一个数组或者指定个数对象转成一个长度固定的List(Arrays的内部返回的ArrayLis实例)
        System.out.println(objects.getClass());
        System.out.println("=======linkedList=========");
        LinkedList<String> strings = new LinkedList<>();
        strings.offer("加入队列尾部");
        strings.push("元素压栈");
        strings.offerFirst("加入队列头部");
        System.out.println(strings.toString());
        System.out.println(strings.peekFirst());//访问并不删除第一个元素
        System.out.println(strings.peekLast());
        System.out.println(strings.pop());//第一个元素弹栈
        System.out.println(strings.pollLast());//访问并删除最后一个元素
        System.out.println(strings.toString());

    }
    @MyInterface(age = 11)
    public void test(){

    }
}
